import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import About from '../views/About'
import Home from '../views/Home'
import News from '../views/News'
import Messages from '../views/Messages'
import MessagesDetial from '../views/MessageDetial'

export default new VueRouter({
    routes:[
        // 这是初始显示的，重定向到about
        {
            path:'/',
            redirect:'/about'
        },
        {
            path:'/about',
            component:About
        },
        {
            path:'/home',
            component:Home,
            children:[
                {
                    path:'/home/',
                    redirect:'/home/news'
                },
                {
                    // 方式一
                    path:'/home/news',
                    component:News
                },
                {
                    // 方式二 简写
                    path:'messages',
                    component:Messages,
                    children:[
                        {
                            path:'/home/messages/MessagesDetial/:msg_id',
                            component:MessagesDetial
                        }
                    ]
                }
            ]
        },
    ]
})